<%@page import="util.Constants" %>
<input type="hidden" name="selectedItemID" value=""/>
<div style="padding: 10px; overflow: auto">
    <div id="section-title">
        <%
        String subPageName = (String) session.getAttribute("subPage");
        String message = (String) session.getAttribute("message");
        String messageType = (String) session.getAttribute("messageType");

        //Only allow getting message one time.
        session.removeAttribute("message");
        out.print("<h2 style='margin: 0px;'>" + subPageName + "</h2>");
        %>
    </div>
    <div id="toolbar">
        <a onclick="redirect(frmIndex, '<%=Constants.DEFECT_LOG_PAGE_NAME%>',
            '<%=Constants.DEFECTLOG_STATISTIC%>')">Statistic</a>
        <a onclick="redirect(frmIndex, '<%=Constants.DEFECT_LOG_PAGE_NAME%>',
            '<%=Constants.DEFECTLOG_SEARCH%>')">Search</a>
        <a onclick="redirect(frmIndex, '<%=Constants.DEFECT_LOG_PAGE_NAME%>',
            '<%=Constants.DEFECTLOG_LIST%>')">View List</a>
        <a onclick="redirect(frmIndex, '<%=Constants.DEFECT_LOG_PAGE_NAME%>',
            '<%=Constants.DEFECTLOG_NEW%>')">New</a>
    </div>
    <div class="clear"></div>
    <hr/>
    
    <% 
    /*
     * Show message from server if it exists.
     */ 
    if((message != null) && !"".equals(message)) {
        %>
        <div class="<%=messageType%>">
            <% 
            out.print(message);
            %>
        </div>
        <%
    }
    %>
    
    <div id="main-page" style="height: 310px;">
        <%
        if (Constants.DEFECTLOG_SEARCH.equalsIgnoreCase(subPageName)) {
            %>
            <%@include file="search.jsp"%>
            <%        
        } else if (Constants.DEFECTLOG_NEW.equalsIgnoreCase(subPageName)) {
            %>
            <%@include file="insert.jsp"%>
            <%        
        } else if (Constants.DEFECTLOG_LIST.equalsIgnoreCase(subPageName)) {
            %>
            <%@include file="list.jsp"%>
            <%        
        } else if(Constants.DEFECTLOG_STATISTIC.equalsIgnoreCase(subPageName)){
            %>
            <%@include file="statistic.jsp"%>
            <%
        } else if(Constants.DEFECTLOG_EDIT.equalsIgnoreCase(subPageName)) {
            %>
            <%@include file="edit.jsp"%>
            <%
        }
        %>
    </div>
    <div style="clear: both"></div>
</div>